<template>
  父组件
  <button @click="btnClick">切换</button>
  <hr />
  <template v-if="isShow">
    <Son></Son>
  </template>
</template>

<script>
import Son from './Son.vue'
export default {
  components: { Son },
  data() {
    return {
      isShow: false,
    }
  },
  methods: {
    btnClick() {
      this.isShow = !this.isShow
    },
  },
  beforeCreate() {
    console.log('父组件beforeCreate')
  },
  created() {
    console.log('父组件created')
  },
  beforeMount() {
    console.log('父组件beforeMount')
  },
  mounted() {
    console.log('父组件mounted')
  },
  beforeUpdate() {
    console.log('父组件beforeUpdate')
  },
  updated() {
    console.log('父组件updated')
  },
  beforeUnmount() {
    console.log('父组件beforeUnmount')
  },
  unmounted() {
    console.log('父组件unmounted')
  },
}
</script>

<style scoped></style>
